MoveAxisRelative

Commands a controlled motion of a specified distance relative to the current set position. The relative distance is added to the current set position at the time this command is called.

Syntax

KsCommandStatus MoveAxisRelative(
     int Index,
     double Distance,
     double Velocity,
     double Acceleration,
     double Deceleration,
     double Jerk,
     McBufferMode BufferMode
);

Parameters

Index [in]: the index of an axis. Indexes are zero based. Aliases affect this parameter.

Distance [in]: the relative distance for the motion. [unit]

Velocity [in]: a value of the maximum velocity. (not necessarily reached) [unit/second]

Acceleration [in]: a value of the acceleration. The unit is determined by the McProfileType type. (increasing energy of the motor) [unit/second2] or [second]

Deceleration [in]: a value of the deceleration. The unit is determined by the McProfileType type. (decreasing energy of the motor) [unit/second2] or [second]

Jerk [in]: a value of the jerk. The unit is determined by the McProfileType type. [unit/second3] or [second]

BufferMode [in]: defines how to blend the velocity of two functions. See the McBufferMode type.

Return value

Returns the KsCommandStatus structure.

Remarks

Example

VOID MoveRelative(INT Index, DOUBLE Distance) {
   //Start an relative move.
   KsCommandStatus status = WaitForCommand(30, TRUE, MoveAxisRelative(Index, Distance, 
      3600, 36000, 36000, 3600000, mcAborting));

   //Print the final position.
   double setPosition = 0;
   KsError nRet = GetAxisPosition(Index, mcSetValue, &setPosition);
   double actPosition = 0;
   nRet = GetAxisPosition(Index, mcSetValue, &actPosition);

   RtPrintf("Current Position: Target %d, Actual %d\n", (int)setPosition, (int)actPosition);
}

Requirements

  RT Win32
Minimum supported version 4.0 4.0
Header ksmotion.h ksmotion.h
Library KsApi_Rtss.lib KsApi.lib

See also

MoveAxisAbsolute

MoveAxisAdditive

MoveAxisVelocity

SimulateAxisRelative